package com.handpay.zztong.hp.main.model.certexpiry;

import com.handpay.framework.fastjson.FastJsonHelper;
import com.handpay.zztong.hp.base.activity.ZZTongActivity;
import com.handpay.zztong.hp.base.callback.BusinessEngineListener;
import com.handpay.zztong.hp.base.model.base.BaseModel;
import com.handpay.zztong.hp.config.HttpUrlConstant;

import java.util.Hashtable;

/**
 * Created by lyang on 2017/3/21.
 */

public class QueryCertNoExpiryDateModel extends BaseModel{
    private BusinessEngineListener mBusinessEngineListener;

    public boolean  doQueryCertNoExpiryDatePost(ZZTongActivity activity, Hashtable<String, String> params, BusinessEngineListener listener) {
        mBusinessEngineListener = listener;
        return doPost(activity, HttpUrlConstant.Do_QueryCertNoExpiryDate, params, true, false);
    }
    @Override
    public boolean netResponse(String action, byte[] data) {
        boolean bResult = super.netResponse(action, data);
        if (bResult) {
            return true;
        }
        if (action.equals(HttpUrlConstant.Do_QueryCertNoExpiryDate)) {
            QueryCertNoExpiryDateBean bean = null;
            if (data_type == DATA_TYPE.DATA_TYPE_JSON) {
                try {
                    String result = new String(data, "UTF-8");
                    bean = FastJsonHelper.getObject(result, QueryCertNoExpiryDateBean.class);
                }catch (Exception e){
                    e.printStackTrace();
                }
            } else {
            }
            if (mBusinessEngineListener != null) {
                mBusinessEngineListener.callbackBusinessResponse(bean);
            }
        }
        return true;
    }
}
